Search Java Code Snippets


  Help us in improving the repository. Add new snippets through 'Submit Code Snippet ' link.





#Java - Code Snippets for '#HttpURLConnection' - 2 code snippet(s) found

 Sample 1. Usage of java.net.HttpURLConnection

HttpURLConnection hc = (HttpURLConnection) new URL(tldurl).openConnection();
if (modTime > 0) {
SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z");//Sun, 06 Nov 1994 08:49:37 GMT
String since = sdf.format(new Date(modTime));
hc.addRequestProperty("If-Modified-Since", since);
}

   Like      Feedback     java.net.HttpURLConnection   HttpURLConnection


 Sample 2. Code Sample / Example / Snippet of java.net.HttpURLConnection

    private HttpURLConnection openConnection() throws IOException {

URL url = m_uri.toURL();



HttpURLConnection conn = (HttpURLConnection) url.openConnection();

conn.setInstanceFollowRedirects(m_client.isFollowRedirects());

conn.setAllowUserInteraction(false);

conn.setDefaultUseCaches(false);

conn.setUseCaches(false);

conn.setConnectTimeout(1000);

conn.setReadTimeout(1000);



return conn;

}


   Like      Feedback      java.net.HttpURLConnection



Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner